package android.framework.app.media;

import android.app.ListActivity;
import android.content.Intent;
import android.framework.global.Constants;
import android.framework.media.PlayActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ArrayAdapter;

public class OctoListHanyaActivity extends ListActivity {
	public static final String LOGTAG = "OctoDemoPlayer";
	private final String[] urls = {
			"octoshape://streams.octoshape.net/hanyastar/s/203/205/2597694_2013-07-15.mp4",
			"octoshape://streams.octoshape.net/hanyastar/s/203/205/2597695_2013-07-15.mp4?protocol=v311",
			"octoshape://streams.octoshape.net/hanyastar/s/203/205/2597696_2013-07-15.mp4?protocol=v311",
			"octoshape://streams.octoshape.net/hanyastar/s/203/205/2597697_2013-07-15.mp4?protocol=v311",
			"octoshape://streams.octoshape.net/hanyastar/s/203/205/2597698_2013-07-15.mp4?protocol=v311" };
	private final String[] titles = { "不想回家第  1 集", "不想回家第 2 集", "不想回家第  3  集",
			"不想回家第 4 集", "不想回家第 5 集", };

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);

		ArrayAdapter<String> adp = new ArrayAdapter<String>(this,
				android.R.layout.simple_list_item_1, android.R.id.text1, titles);
		getListView().setAdapter(adp);
		getListView().setOnItemClickListener(new OnItemClickListener() {

			@Override
			public void onItemClick(AdapterView<?> parent, View view,
					int position, long id) {
				Intent intent = new Intent();
				intent.setClass(OctoListHanyaActivity.this, PlayActivity.class);
				Bundle bundle = new Bundle();
				bundle.putString("url", urls[position]);
				bundle.putString("title", titles[position]);
				bundle.putBoolean(Constants.FROM_PUSH, false);
				bundle.putInt(Constants.PLAY_TYPE, Constants.PLAY_OCTO);
				intent.putExtra(Constants.PLAY_PARM, bundle);
				startActivity(intent);
			}
		});
	}

}
